% This is to read *_raw.mat to display 2D data for publication
close all
clearvars
clc

MATfile={
    'sphingo3_scan255_raw.mat'; % NaCl + FeCl3
    'sphingo4_scan72_raw.mat'; % KI + FeCl3
    'sphingo3_scan317_raw.mat';% CaCl2 + FeCl3
    'sphingo3_scan90_raw.mat';% LaCl3 +KCl
    'water1_scan36_raw.mat'; %Water
    }

FileSelect=5;

data=load(MATfile{FileSelect});
mon=data.mon;
qz=data.qz;

%change qz
qz_new = qz/0.0218;

ct=data.ct;
energy=data.energy;
mca=data.mca;
rng=energy<8.1 & energy>1.9;
% rng=energy>6 & energy< 7.5;
% rng=energy>12;
smear=ones(5,1);
mca_new=convn(mca,smear,'same');
mca_conv = log (mca_new + 1) ;


contourf(qz_new,energy(rng),mca_conv(rng,:),[0:1.0:5],'LineColor', 'none');


colorbar;
% Additional plot settings
colorbarHandle = colorbar;
set(colorbarHandle, 'TickDirection', 'out');   % Set colorbar ticks to 'out'
set(colorbarHandle, 'LineWidth', 2);           % Set colorbar boundary and tick thickness
set(colorbarHandle, 'FontName', 'Arial');
set(colorbarHandle, 'FontSize', 25);% Set the colorbar font to Arial
% set(colorbarHandle, 'Ticks', [0 1 2 3 4]);

set(gca, 'FontName', 'Arial'); % Set the axes font to Arial
set(gca, 'ydir', 'normal');
set(gca, 'ytick', [2:1:14]);
set(gca, 'ylim', [2 7.5]);
set(gca, 'xlim', [0.46 1.6]);
% set(gca, 'xtick', [0.01:0.005:0.035]);
set(gca, 'fontsize', 25);
set(gca, 'LineWidth', 2);
set(gca, 'TickDir', 'out');
xlabel('${\alpha_i}/{\alpha_c}$', 'Interpreter', 'latex', FontSize = 35);
ylabel('Energy (keV)',FontSize=30);

axis square
%grid on






